package com.sxbbc.common.core.enums;

import java.util.ArrayList;
import java.util.List;

import com.sxbbc.common.basics.utils.calculation.CalcuUtils;

/**
 * 
 *  资金类型
 * @author Wahyee
 */
public enum FundTypeEnums {
	MONEY(1,"余额",true),
	DONATE(3,"贡献值",false),
	SHARE(4,"共享值",false);
	
	private Integer id;
	 
    private String name;
    
    /** 是否显示 */
    private boolean canShow;
    
    
    
    public boolean isCanShow() {
		return canShow;
	}

	public void setCanShow(boolean canShow) {
		this.canShow = canShow;
	}

	public Integer getId() {
		return id;
	}
	
	public void setId(Integer id) {
		this.id = id;
	}
	
	public String getName() {
		return name;
	}
	
	public void setName(String name) {
		this.name = name;
	}
 
	private FundTypeEnums(Integer id,String name){
		this.id=id;
		this.name=name;
	}
	
	private FundTypeEnums(Integer id, String name, boolean canShow) {
		this.id = id;
		this.name = name;
		this.canShow = canShow;
	}

	public static String getName(Integer id){
		String str="";
		for(FundTypeEnums o:FundTypeEnums.values()){
			if(CalcuUtils.getInstance().isEquals(id, o.getId())){
				str= o.getName();
				break;
			}
		}
		return str;
	}
	
	public static List<FundTypeEnums> queryList(){
		List<FundTypeEnums> list=new ArrayList<FundTypeEnums>();
		for(FundTypeEnums o:FundTypeEnums.values()){
			list.add(o);
		}
		return list;
	}
	
	public static List<FundTypeEnums> queryListCanShow(){
		List<FundTypeEnums> list=new ArrayList<FundTypeEnums>();
		for(FundTypeEnums o:FundTypeEnums.values()){
			if(o.isCanShow()) {
				list.add(o);
			}
		}
		return list;
	}
	
	
	public static FundTypeEnums getEnums(Integer paytype){
		for(FundTypeEnums o:FundTypeEnums.values()){
			if(CalcuUtils.getInstance().isEquals(paytype, o.getId())){
				return o;
			}
		}
		return null;
	}
	
	
	public static boolean isPay(Integer id) {
		for(FundTypeEnums o:FundTypeEnums.values()){
			if(CalcuUtils.getInstance().isEquals(id, o.getId())){
				return true;
			}
		}
		return false;
	}
}
